INCLUDEDIR = include
OBJDIR = obj
SRCDIR = src
CFLAGS = -g -Wall -I $(INCLUDEDIR)

GRAMOBJ = ${OBJDIR}/grammatic.o
LISTOBJ = ${OBJDIR}/list.o
TESTGRAMOBJ = ${OBJDIR}/testgram.o

clean:
	@rm -f analyGrammatic
	@rm -f lex.yy.c
	@rm -f *.o
	@rm -f ${OBJDIR}/*.o
	@rm -f ${INCLUDEDIR}/*~
	@rm -f ${SRCDIR}/*~
	@rm -f *~
	@rm -f testgram

all: ${GRAMOBJ} ${LISTOBJ}
	flex src/tpe.l
	gcc lex.yy.c -lfl ${GRAMOBJ} ${LISTOBJ} -o analyGrammatic -g

testgram: ${GRAMOBJ} ${LISTOBJ} ${TESTGRAMOBJ} ${PERLSTRINGOBJ}
	@gcc ${CFLAGS} ${GRAMOBJ} ${LISTOBJ} ${TESTGRAMOBJ} -o testgram
	

${GRAMOBJ}: ${SRCDIR}/grammaticCDT.c
	@gcc ${CFLAGS} -c ${SRCDIR}/grammaticCDT.c -o ${GRAMOBJ}

${LISTOBJ}: ${SRCDIR}/list.c
	@gcc ${CFLAGS} -c ${SRCDIR}/list.c -o ${LISTOBJ}

${TESTGRAMOBJ}: ${SRCDIR}/testGrammaticADT.c
	@gcc ${CFLAGS} -c ${SRCDIR}/testGrammaticADT.c -o ${TESTGRAMOBJ}

